import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import router from '@/router/index';

export const routerStore = defineStore('Router',{
  state: () => ({
    home:true,
    upload:false,
    purchase:false,
    showSign :false,
    showLogin:false,
    data:false,
    
  }),
 actions:{
  openSign(){
 this.showSign=true;
  },
  closeSign(){
    this.showSign=false;
  },
  openLogin (){
    this.showLogin=true;
  },
  closeLogin(){
    this.showLogin=false;
  },
  homePage(){
    this.home=true;
    this.upload=false;
    this.purchase=false;
    this.data=false;
    router.push('/');
    console.log(this.home)
  },
  uploadPage(){
    this.upload=true;
    this.home=false;
    this.purchase=false;
    this.data=false;
    router.push('/upload');
    console.log(this.upload)
  },
  purchasePage(){
    this.purchase=true;
    this.upload=false;
    this.home=false;
    this.data=false;
    router.push('/buy');
  },
  dataPage(){
    this.data=true;
    this.upload=false;
    this.home=false;
    this.purchase=false;
    router.push('/data');
  }
},
})











// export const useCounterStore = defineStore('counter', () => {
//   const count = ref(0)
//   const doubleCount = computed(() => count.value * 2)
//   function increment() {
//     count.value++
//   }

//   return { count, doubleCount, increment }
// })
